import {getData} from '../models/fetch'
import groupTpl from '../views/group.html'
import groupListTpl from '../views/group-list.html'

async function render(){
    $('main').html(groupTpl)
    //点击切换home-nav样式
    $('#group-nav').on('click','li',function(){
        $(this).addClass('active').siblings().removeClass('active');
    })
    let res = await getData('/group/yiqituan/tab_list?tab=coutuan_home&page=1&per_page=20')
    let data = res.data;
    console.log(data)
    //通过请求的goodsList用template渲染页面
    let renderGroupTpl = template.render(groupListTpl, {data})
    $('.group-list').html(renderGroupTpl)
}

export default{
    render
}